﻿using SpaceNeedle.City6473.Web.Data.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SpaceNeedle.City6473.WebSite.Security.Mvc;

namespace SpaceNeedle.City6473.WebSite.Controllers
{
    public class AppContentController : GlobalController
    {
        [Secure]
        public ActionResult Index()
        {
            var appContent = new AppContentsController().Get("pt-br");

            if(appContent == null)
            {
                appContent = new Web.Data.Models.AppContent();
            }

            return View(appContent);
        }

        [Secure]
        [HttpPost]
        public ActionResult Index(AppContent model)
        {
            model.UpdateDate = DateTime.UtcNow;
            new AppContentsController().Put(model);

            return View(model);
        }
    }
}